package cate.game.train.hero.msg;

import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdBTrain;
import cate.game.role.bag.hero.Hero;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.List;
import java.util.stream.Collectors;

@ClientMsg(title = "英雄基础信息批量更新 の 返回")
public class HeroBaseBatchUpdateResp implements MsgOutput {
    @NoteField("数据")
    public List<HeroBaseData> data;

    public HeroBaseBatchUpdateResp(){}

    public HeroBaseBatchUpdateResp(List<Hero> hero) {
        data = hero.stream().map(e -> {
            HeroBaseData d = new HeroBaseData();
            d.uid = e.uid;
            d.grade = e.grade;
            d.tid = e.tid;
            d.level = e.level;
            d.shareGrade = e.shareGrade;
            d.shareLevel = e.shareLevel;
            return d;
        }).collect(Collectors.toList());
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.BATCH_HERO_UPDATE_RESP;
    }

    @NoteClass("食灵基础数据")
    public class HeroBaseData{
        @NoteField(value = "英雄唯一ID")
        public String uid;

        @NoteField(value = "英雄模板ID")
        public int tid;

        @NoteField(value = "等级")
        public int level;

        @NoteField(value = "英雄阶数")
        public int grade;

        @NoteField(value = "共享等级")
        public int shareLevel;

        @NoteField(value = "英雄共享阶数")
        public int shareGrade;
    }
}
